//
//  YTAdRecommendVC.m
//  CllForIOS
//
//  Created by qiyun on 2018/3/20.
//  Copyright © 2018年 aRui. All rights reserved.
//

#import "YTAdRecommendVC.h"
#import "YTRecommendCell.h"
@interface YTAdRecommendVC ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView * tableView;
@property (nonatomic, strong) NSArray * titleArray;
@property (nonatomic, strong) NSArray * destitleArray;
@property (nonatomic, strong) NSArray * iconArray;
@end

@implementation YTAdRecommendVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNav];
    self.view.backgroundColor=RGBA(236, 236, 236);
    self.tableView.backgroundColor=[UIColor whiteColor];
    
    self.titleArray=@[@"足球爱好者",@"灌篮高手",@"无言君",@"追风"];
    self.destitleArray=@[@"我上线了 ，欢迎大家关注我",@"",@"",@"",@"",@"此处不要超过个字啦啦啦啦啦 啦啦啦啦拉拉拉拉啦啦",@"此处不要超过个字啦啦啦啦啦 啦啦啦啦拉拉拉拉啦啦",@"此处不要超过个字啦啦啦啦啦 啦啦啦啦拉拉拉拉啦啦"];
    self.iconArray=@[@"icon5",@"icon5",@"icon5",@"icon5",@"icon5",@"icon5",@"icon5",@"icon5"];
}
-(void)setNav{
    self.titleLabel.text=@"名人推荐";
    self.lineView.hidden=YES;
    [self.leftimaBtn setImage:IMAGE(@"Mine_back") forState:UIControlStateNormal];
   
}
- (UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, k_statusbarHeight+49+12, SCREEN_W, SCREEN_H-k_statusbarHeight-49) style:UITableViewStylePlain];
        _tableView.separatorColor = RGBA(223, 223, 223);
        _tableView.separatorInset = UIEdgeInsetsMake(0, 12, 0, 12);
        _tableView.scrollEnabled=YES;
        _tableView.delegate = self;
        _tableView.dataSource = self;
        [self.view addSubview:_tableView];
        _tableView.tableFooterView = [UIView new];
        [_tableView registerClass:[YTRecommendCell class] forCellReuseIdentifier:@"YTRecommendCell"];
        
        if ([_tableView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) {
            _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        }
    }
    return _tableView;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return  self.titleArray.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.0001f;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.0001f;
}

//- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
//    UIView*scetionheadview=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_W, 12)];
//    scetionheadview.backgroundColor=RGBA(236, 236, 236);
//    return scetionheadview;
//}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return AfW(73);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * cellId = @"YTRecommendCell";
    YTRecommendCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.title.text=self.titleArray[indexPath.row];
    cell.destitle.text=self.destitleArray[indexPath.row];
    cell.icon.image=IMAGE(self.iconArray[indexPath.row]);

    return cell;
    
    
}

@end
